import sys
import os


def curr():
    """取得脚本所在目录"""
    exec = sys.argv[0]
    return os.path.dirname(exec)


def log(msg, file):
    with open(file, "a", encoding="utf-8") as f:
        print(msg, file=f)


log("4\n4444", os.path.join(curr(), "log.txt"))
